const state = {
  dragBarData: {},
  leftCenterConArr: [],
  drogEchartsId: null,
  menuVisible: null,
  menuVisibleTwo: null,
  onclickFlag: true,
  ceshiMd: null,
  dragFlag: false,
  overPath: {
    overUrl: "", // http://127.0.0.1:4523/m1/1896700-0-default
    overTime: 30,
    overTimeType: "s",
    HeaderOne: [
      {
        key: "", // Authorization
        value: "", // ceshiyiduan
      },
    ],
  },
  path: {
    getPathShow: false,
    getUrl: "",
    getTime: 0,
    getTimeType: "s",
    getType: "get",
    select: "Params",
    disabled: true,
    status: 0,
    params: [
      {
        key: "",
        value: "",
      },
    ],
    Header: [
      {
        key: "",
        value: "",
      },
    ],
    body: [
      {
        key: "",
        value: "",
      },
    ],
  },
  colorArr: JSON.parse(localStorage.getItem("euworkShop_goViewColor")),
};
const actions = {
  overPathFunc({ commit, state }) {
    const path = {
      overUrl: "", // http://127.0.0.1:4523/m1/1896700-0-default
      overTime: 30,
      overTimeType: "s",
      HeaderOne: [
        {
          key: "", // Authorization
          value: "", // ceshiyiduan
        },
      ],
    };
    commit("OVER_PATH", path);
  },
};
const mutations = {
  DRAG_BAR_DATA: (state, dragBarData) => {
    state.dragBarData = dragBarData;
  },
  LEFT_CENTER_CON_ARR: (state, leftCenterConArr) => {
    state.leftCenterConArr = leftCenterConArr;
  },
  DROG_ECHARTS_ID: (state, drogEchartsId) => {
    state.drogEchartsId = drogEchartsId;
  },
  PATH: (state, path) => {
    state.path = path;
  },
  DISABLE: (state, disabled) => {
    state.disabled = disabled;
  },
  MENU_VISIBLE: (state, menuVisible) => {
    state.menuVisible = menuVisible;
  },
  MENU_VISIBLE_TWO: (state, menuVisibleTwo) => {
    state.menuVisibleTwo = menuVisibleTwo;
  },
  ON_CLICK_FLAG: (state, onclickFlag) => {
    state.onclickFlag = onclickFlag;
  },
  OVER_PATH: (state, overPath) => {
    state.overPath = overPath;
  },
  DRAG_FLAG: (state, dragFlag) => {
    state.dragFlag = dragFlag;
  },
  COLOR_ARR: (state, colorArr) => {
    state.colorArr = colorArr;
    localStorage.setItem("euworkShop_goViewColor", JSON.stringify(colorArr));
  },
  CESHI_MD: (state, id) => {
    state.leftCenterConArr = state.leftCenterConArr.filter((item) => {
      return item.id != id;
    });
    state.drogEchartsId = null;
  },
};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
